package com.atguigu.gulimall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @create 2020-07-08 11:13 上午
 * @function: 创建Redisson实例
 **/
@Configuration
public class MyRedissonConfig {

    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() {
        // 创建配置
        Config config = new Config();
        config.useSingleServer().setAddress("redis://10.211.55.4:6379");
        // 根据配置获取Redisson实例
        RedissonClient redissonClient = Redisson.create(config);
        return redissonClient;
    }
}
